package com.bossien.flink.config;

import com.bossien.flink.interfaces.IEnviroment;
import lombok.Data;
import org.apache.flink.api.common.time.Time;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.springframework.context.annotation.Configuration;

/**
 * @author 胡春林
 * 流式处理对象
 */
@Configuration
@Data
public class StreamEnvironmention implements IEnviroment {

    private StreamExecutionEnvironment streamExecutionEnvironment;

    //任务重试次数
    private int failureRate;
    //任务失败间隔
    private Time failureInterval;
    //任务失败延时重试间隔
    private Time delayInterval;
    //设置作业的默认并发度
    private String parallelism;
    //设置作业的默认最大并发度
    private String maxParallelism;
    //缓存区超时
    private long bufferTimeout;


    @Override
    public StreamExecutionEnvironment init() {
        //开始进行配置
       return  this.streamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
    }

    @Override
    public void destory() { this.streamExecutionEnvironment = null;}
}
